package com.zjw.remotecall.streamacceptor;

import android.os.Parcel;

import androidx.annotation.NonNull;
import androidx.annotation.Nullable;

import com.zjw.remotecall.utils.RemoteUtils;


/**
 * @author ：zhong.jw
 * @date ：Created in 2022/12/1 10:13
 * <p>
 * 同步状态下Sync
 */
public class SyncRemoteCallResult extends RemoteCallResult {

    private final long mSyncCode;

    public SyncRemoteCallResult(@Nullable Object obj, @NonNull String syncKey) {
        super(obj);
        mSyncCode = RemoteUtils.sync(syncKey);
    }

    protected SyncRemoteCallResult(Parcel in) {
        super(in);
        mSyncCode = in.readLong();
    }

    public static final Creator<SyncRemoteCallResult> CREATOR = new Creator<SyncRemoteCallResult>() {
        @Override
        public SyncRemoteCallResult createFromParcel(Parcel in) {
            return new SyncRemoteCallResult(in);
        }

        @Override
        public SyncRemoteCallResult[] newArray(int size) {
            return new SyncRemoteCallResult[size];
        }
    };


    @Override
    public void writeToParcel(Parcel dest, int flags) {
        super.writeToParcel(dest, flags);
        dest.writeLong(mSyncCode);
    }

    public long getSyncCode() {
        return mSyncCode;
    }
}
